﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace YJKDataLookAfter
{
	public partial class DlgAddRole : System.Windows.Forms.Form
	{
		public DlgAddRole(string group)
		{
			this.mGroup = group;
			this.InitializeComponent();
		}

		private void DlgAddRole_Load(object sender, EventArgs e)
		{
		}

		private void btnCancle_Click(object sender, EventArgs e)
		{
		}

		private void btnOK_Click(object sender, EventArgs e)
		{
			if (this.txtName.Text.Trim() != "")
			{
				try
				{
					new DbRole(this.txtName.Text.Trim(), this.txtDesc.Text.Trim(), this.mGroup).AddToDb(BimServerDB.Default);
					this.txtName.Text = "";
					this.txtDesc.Text = "";
					MessageBox.Show("添加成功。");
				}
				catch (Exception)
				{
					MessageBox.Show("添加失败，请检查职位是否重名。");
				}
			}
		}

		private string mGroup = "";
	}
}
